import {request} from '../utils/request';
export default ({data}) => {
  return <ul>
    {
      data.map((item, key) => {
        return <li key={key}>{item.q}</li>;
      })
    }
  </ul>;
};


export async function getServerSideProps(){
  const url = 'https://www.baidu.com/sugrec?prod=pc_his&from=pc_web&json=1&sid=32098_1457_31325_21103_31763_32045_31708_30824_31845_26350_22160&hisdata=%5B%7B%22time%22%3A1583932252%2C%22kw%22%3A%22python%22%7D%2C%7B%22time%22%3A1588223755%2C%22kw%22%3A%22pornhub%E7%9A%84%E5%9C%B0%E5%9D%80%22%7D%2C%7B%22time%22%3A1592668695%2C%22kw%22%3A%22sass%22%7D%5D&req=2&sc=eb&csor=0';
  const html = await request(url);
  const data = JSON.parse(html);
  return {
    props: {data: data.g}
  };
}